package com.dp.vo;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;


@Entity
@Table(name = "t_ebook_resource")
//@NamedQueries({@NamedQuery(name = "TEbookResource.findAll", query = "SELECT t FROM TEbookSection t"), @NamedQuery(name = "TEbookSection.findByResourceid", query = "SELECT t FROM TEbookResource t WHERE t.resourceid = :resourceid")})
public class TEbookResource  implements Serializable{
	private static final long serialVersionUID = 1L;
	@Id
	@Basic(optional = false)
	@Column(name = "resourceid")
	private String resourceid;                    //资源id
	/*@Column(name = "t_e_contentid")     
	private String te_contentid;                 //所属ebook内容id
*/	//@Column(name = "sectionid")
	//private String sectionid;                    //章节id
	@Column(name = "news_rid")
	private String newsrid;  					  //保存图片资源对应在news_resource表记录的rid	
	@Column(name = "useragent")
	private String useragent;                    //UA组
	@Column(name = "filename")
	private String filename;   
	@Column(name = "ctype")
	private String ctype;   
	@Column(name = "spcode")
	private String spcode;   
	@Column(name = "curl")
	private String curl; 
	@Column(name = "duration")
	private Integer duration; 
	@Column(name = "size")
	private Integer size; 
	@Column(name = "cformat")
	private String cformat; 
	@Column(name = "newformat")
	private String newformat; 
	@Column(name = "fullpath")
	private String fullpath; 
	@JoinColumn(name = "t_e_contentid", referencedColumnName = "contentid")   
	@ManyToOne
    private TEbookContent tebookContent;		//所属ebook内容
	@JoinColumn(name = "sectionid", referencedColumnName = "sectionid")   
	@ManyToOne
    private TEbookSection tebookSection;		//所属ebook内容的章节
	
	public TEbookResource(){
	}
    public TEbookResource(String te_contentid){
		this.tebookContent.setContentid(te_contentid);
	}
   /* public TEbookResource(String te_contentid,String sectionid){
		this.te_contentid=te_contentid;
		this.sectionid=sectionid;
	}*/
	public String getResourceid() {
		return resourceid;
	}
	public void setResourceid(String resourceid) {
		this.resourceid = resourceid;
	}
	/*public String getTe_contentid() {
		return te_contentid;
	}
	public void setTe_contentid(String te_contentid) {
		this.te_contentid = te_contentid;
	}*/
	/*public String getSectionid() {
		return sectionid;
	}
	public void setSectionid(String sectionid) {
		this.sectionid = sectionid;
	}*/
	public String getNewsrid() {
		return newsrid;
	}
	public void setNewsrid(String newsrid) {
		this.newsrid = newsrid;
	}
	public String getUseragent() {
		return useragent;
	}
	public void setUseragent(String useragent) {
		this.useragent = useragent;
	}
	public String getFilename() {
		return filename;
	}
	public void setFilename(String filename) {
		this.filename = filename;
	}
	public String getSpcode() {
		return spcode;
	}
	public void setSpcode(String spcode) {
		this.spcode = spcode;
	}
	public String getCtype() {
		return ctype;
	}
	public void setCtype(String ctype) {
		this.ctype = ctype;
	}
	public String getCurl() {
		return curl;
	}
	public void setCurl(String curl) {
		this.curl = curl;
	}
	public Integer getDuration() {
		return duration;
	}
	public void setDuration(Integer duration) {
		this.duration = duration;
	}
	public Integer getSize() {
		return size;
	}
	public void setSize(Integer size) {
		this.size = size;
	}
	public String getCformat() {
		return cformat;
	}
	public void setCformat(String cformat) {
		this.cformat = cformat;
	}
	public String getNewformat() {
		return newformat;
	}
	public void setNewformat(String newformat) {
		this.newformat = newformat;
	}
	public String getFullpath() {
		return fullpath;
	}
	public void setFullpath(String fullpath) {
		this.fullpath = fullpath;
	}
	public TEbookContent getTebookContent() {
		return tebookContent;
	}
	public void setTebookContent(TEbookContent tebookContent) {
		this.tebookContent = tebookContent;
	}
	public TEbookSection getTebookSection() {
		return tebookSection;
	}
	public void setTebookSection(TEbookSection tebookSection) {
		this.tebookSection = tebookSection;
	}
	
	@Override
	public int hashCode() {
	        int hash = 0;
	        hash += (resourceid != null ? resourceid.hashCode() : 0);
	        return hash;
	}

    @Override
	public boolean equals(Object object) {
	    if (!(object instanceof TEbookContent)) {
	          return false;
	     }
	    TEbookResource other = (TEbookResource) object;
	     if ((this.resourceid == null && other.resourceid != null) || (this.resourceid != null && !this.resourceid.equals(other.resourceid))) {
	         return false;
	     }
	     return true;
	}
	    
	@Override
    public String toString() {
        return "com.dp.vo.TEbookResource[resourceid=" + resourceid + "]";
    }
	
	

}
